<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/12/1
  Time: 19:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
  <script src="/static/js/jquery-3.6.0.js"></script>
  <script>
      $(function (){
          $("#btn").click(function (){
              $.post({
                  url:"${pageContext.request.contextPath}/a2",
                  success:function (data){
                      var html;
                      for (let i = 0; i < data.length; i++) {
                           html+="<tr>"+
                               "<td>"+data[i].name+"</td>"+
                               "<td>"+data[i].age+"</td>"+
                               "</tr>"
                      }
                      $("#content").html(html);
                  }
              });
          });
      });

  </script>
</head>
<body>
    <div><input type="button" value="提交" id="btn"></div>
    <div>
        <table>
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>年龄</th>
                </tr>
            </thead>
            <tbody id="content">

            </tbody>
        </table>
    </div>
</body>
</html>
